﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Dialog.Master" AutoEventWireup="true"
    CodeBehind="ChooseOrderForInvoice.aspx.cs" Inherits="NetDon.OA.Portal.Finance.ChooseOrderForInvoice" %>

<%@ Import Namespace="NetDon.OA.Interface" %>
<%@ Import Namespace="NetDon.Utilities" %>
<%@ Register Src="../Controls/GridPager.ascx" TagName="GridPager" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script language="javascript" type="text/javascript">
        function SelectAll(evtObj) {
            Array.forEach($array($get('<%=grdInvoiceOrder.ClientID %>').getElementsByTagName("input")), function (elt) {

                if (elt.type == "checkbox" && elt.disabled == false) {
                    elt.checked = evtObj.checked;
                }
            })
        }
      
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:Panel runat="server" DefaultButton="btnSave" ID="Panel1" Style="overflow: hidden">
        <asp:Panel ID="Panel2" runat="server" DefaultButton="btnSearch">
            <table border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td>
                        <NetDon:FormPanel ID="PanelCondition" runat="server" CaptionAlign="NotSet" RepeatColumns="2">
                            <Items>
                                <NetDon:FormItem HeaderText="线路分类">
                                    <ContentTemplate>
                                        <asp:DropDownList ID="ddlRouteTypeId" DataSourceID="ddsRouteTypeId" AppendDataBoundItems="True"
                                            runat="server" DataTextField="Name" DataValueField="Value">
                                        </asp:DropDownList>
                                        <NetDon:DictionaryDataSource ID="ddsRouteTypeId" runat="server" CategoryName="线路分类"
                                            EmptyItemType="Select">
                                        </NetDon:DictionaryDataSource>
                                    </ContentTemplate>
                                </NetDon:FormItem>
                                <NetDon:FormItem HeaderText="客户">
                                    <ContentTemplate>
                                        <asp:DropDownList ID="ddlCustomer" runat="server" DataSourceID="ObjectDataSourceCustomers"
                                            DataTextField="CustomerName" DataValueField="CustomerId" AppendDataBoundItems="true">
                                        </asp:DropDownList>
                                        <asp:ObjectDataSource ID="ObjectDataSourceCustomers" runat="server" OldValuesParameterFormatString="original_{0}"
                                            SelectMethod="RetrieveCustomers" TypeName="NetDon.OA.Business.MiscDataSource">
                                            <SelectParameters>
                                                <asp:Parameter Name="areaId" />
                                            </SelectParameters>
                                        </asp:ObjectDataSource>
                                    </ContentTemplate>
                                </NetDon:FormItem>
                           
                                <NetDon:FormItem HeaderText="对账否">
                                    <ContentTemplate>
                                        <asp:RadioButton ID="radioIsInvoiceNeededYes" runat="server" Text="是" Checked="True"
                                            Enabled="False"></asp:RadioButton>
                                    </ContentTemplate>
                                </NetDon:FormItem>
                                <NetDon:FormItem HeaderText="确认对账日期">
                                    <ContentTemplate>
                                        <asp:TextBox ID="txtConfirmStatementofAccountDateStart" runat="server" Width="75px"
                                           ></asp:TextBox>
                                        <asp:CalendarExtender ID="CalendarExtender3" runat="server" Enabled="True" TargetControlID="txtConfirmStatementofAccountDateStart"
                                            Format="yyyy-MM-dd">
                                        </asp:CalendarExtender>
                                        <asp:Label ID="Label2" runat="server" Text="~" Style="margin-left: 5px; margin-right: 6px"></asp:Label>
                                        <asp:TextBox ID="txtConfirmStatementofAccountDateEnd" runat="server" Width="75px"
                                           ></asp:TextBox>
                                        <asp:CalendarExtender ID="CalendarExtender4" runat="server" Enabled="True" TargetControlID="txtConfirmStatementofAccountDateEnd"
                                            Format="yyyy-MM-dd">
                                        </asp:CalendarExtender>
                                    </ContentTemplate>
                                </NetDon:FormItem>
                                <NetDon:FormItem HeaderText="应开票日期">
                                    <ContentTemplate>
                                        <asp:TextBox ID="txtDueInvoiceDateStart" runat="server" Width="75px"></asp:TextBox>
                                        <asp:CalendarExtender ID="CalendarExtender5" runat="server" Enabled="True" TargetControlID="txtDueInvoiceDateStart"
                                            Format="yyyy-MM-dd">
                                        </asp:CalendarExtender>
                                        <asp:Label ID="Label3" runat="server" Text="~" Style="margin-left: 5px; margin-right: 6px"></asp:Label>
                                        <asp:TextBox ID="txtDueInvoiceDateEnd" runat="server" Width="75px" ></asp:TextBox>
                                        <asp:CalendarExtender ID="CalendarExtender6" runat="server" Enabled="True" TargetControlID="txtDueInvoiceDateEnd"
                                            Format="yyyy-MM-dd">
                                        </asp:CalendarExtender>
                                    </ContentTemplate>
                                </NetDon:FormItem>
                                <NetDon:FormItem HeaderText="承运公司">
                                    <ContentTemplate>
                                        <asp:DropDownList ID="ddlCompany" runat="server" DataSourceID="ObjectDataSourceCompany"
                                            DataTextField="CompanyName" DataValueField="CompanyId" AppendDataBoundItems="true">
                                        </asp:DropDownList>
                                        <asp:ObjectDataSource ID="ObjectDataSourceCompany" runat="server" OldValuesParameterFormatString="original_{0}"
                                            SelectMethod="RetrieveCompanies" TypeName="NetDon.OA.Business.MiscDataSource">
                                        </asp:ObjectDataSource>
                                    </ContentTemplate>
                                </NetDon:FormItem>
                            </Items>
                        </NetDon:FormPanel>
                    </td>
                    <td valign="bottom">
                        <asp:Button ID="btnSearch" runat="server" Text="查询" SkinID="Button80" OnClick="btnSearch_Click" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
        <div style="margin-top: 10px">
            <NetDon:GridView ID="grdInvoiceOrder" BorderWidth="0px" CellPadding="0" CellSpacing="0"
                Width="100%" AutoGenerateColumns="false" runat="server" OnRowDataBound="grdInvoiceOrder_RowDataBound">
                <Columns>
                    <NetDon:TemplateField>
                        <HeaderStyle HorizontalAlign="Center" />
                        <HeaderTemplate>
                            <asp:CheckBox ID="chkSelectAll" runat="server" onclick="SelectAll(this)" />
                        </HeaderTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                        <ItemTemplate>
                            <asp:CheckBox ID="chkSelect" runat="server" />
                        </ItemTemplate>
                    </NetDon:TemplateField>
                    <NetDon:BoundField HeaderText="订单编号" DataField="OrderCode" SortExpression="OrderCode">
                    </NetDon:BoundField>
                    <NetDon:BoundField HeaderText="实发货日期" DataField="ActualShippingDate" SortExpression="ActualShippingDate"
                        DataFormatString="{0:yyyy-MM-dd}">
                    </NetDon:BoundField>
                    <asp:BoundField HeaderText="运输计划号" DataField="TransportationPlanCode" SortExpression="TransportationPlanCode">
                    </asp:BoundField>
                    <NetDon:TemplateField HeaderText="送货城市">
                        <ItemTemplate>
                            <%#Server.HtmlEncode(GetCityName(Eval("IssuingOrderId")))%>
                        </ItemTemplate>
                    </NetDon:TemplateField>
                    <NetDon:TemplateField HeaderText="送货地址">
                        <ItemTemplate>
                            <asp:Label ID="lblMessage" runat="server" Text='<%# GetShortDeliveryAddress(Eval("IssuingOrderId")) %>'
                                Style="cursor: pointer" ToolTip='<%# GetDeliveryAddress(Eval("IssuingOrderId")) %>'></asp:Label>
                        </ItemTemplate>
                    </NetDon:TemplateField>
                    <NetDon:TemplateField HeaderText="实际装车材积" SortExpression="ActualOrderVolumn">
                        <ItemTemplate>
                            <%#!MiscUtilities.IsNullOrEmpty(Eval("ActualOrderVolumn")) ? Convert.ToDecimal(Eval("ActualOrderVolumn")).ToString("#,###.00") : ""%>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Right"></ItemStyle>
                    </NetDon:TemplateField>
                    <NetDon:TemplateField HeaderText="实际装车重量" SortExpression="ActualOrderWeight">
                        <ItemTemplate>
                            <%#!MiscUtilities.IsNullOrEmpty(Eval("ActualOrderWeight")) ? Convert.ToInt32(Eval("ActualOrderWeight")).ToString("#,###") : ""%>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Right"></ItemStyle>
                    </NetDon:TemplateField>
                    <NetDon:TemplateField HeaderText="实际装车数量" SortExpression="ActualOrderQuantity">
                        <ItemTemplate>
                            <%#!MiscUtilities.IsNullOrEmpty(Eval("ActualOrderQuantity")) ? Convert.ToInt32(Eval("ActualOrderQuantity")).ToString("#,###") : ""%>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Right"></ItemStyle>
                    </NetDon:TemplateField>
                    <NetDon:TemplateField HeaderText="营业收入(￥)" SortExpression="Revenues">
                        <ItemTemplate>
                            <%#!MiscUtilities.IsNullOrEmpty(Eval("Revenues")) ? ((Decimal)Eval("Revenues")).ToString("#,###.00") : ""%>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Right"></ItemStyle>
                    </NetDon:TemplateField>
                    <NetDon:TemplateField HeaderText="营业总收入(￥)" SortExpression="TotalRevenues">
                        <ItemTemplate>
                            <%#!MiscUtilities.IsNullOrEmpty(Eval("TotalRevenues")) ? ((Decimal)Eval("TotalRevenues")).ToString("#,###.00") : ""%>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Right"></ItemStyle>
                    </NetDon:TemplateField>
                    <%--           <asp:TemplateField HeaderText="操作" ItemStyle-Width="100px">
                                <ItemTemplate>
                                    <asp:ImageButton ID="btnDetails" Style="margin-left: 5px" ToolTip="Details" runat="server"
                                        SkinID="ViewDetail" ImageAlign="AbsMiddle" CausesValidation="false" />
                                    <asp:ImageButton ID="btnDelete" runat="server" SkinID="Delete" />
                                </ItemTemplate>
                            </asp:TemplateField>--%>
                </Columns>
                <HeaderStyle CssClass="test" />
                <RowStyle CssClass="test" />
                <AlternatingRowStyle CssClass="GridRow1" />
            </NetDon:GridView>
          
        </div>
        <div style="margin-top: 10px; text-align: center;">
            <asp:ValidationSummary ID="ValidationSummary2" runat="server" DisplayMode="List"
                ShowMessageBox="True" ShowSummary="False" />
        
            <asp:Button ID="btnSave" runat="server" Text="选择" OnClick="btnChoose_Click" Style="margin-right: 5px">
            </asp:Button>
            <asp:Button ID="btnCancel" runat="server" Text="取消" CausesValidation="false" SkinID="Button60"
                Style="margin-left: 5px"></asp:Button>
        </div>
    </asp:Panel>
</asp:Content>
